'use strict';

var _interopRequireDefault = require('@babel/runtime/helpers/interopRequireDefault');
Object.defineProperty(exports, '__esModule', {
  value: true,
});
exports.default = void 0;
var _objectSpread2 = _interopRequireDefault(require('@babel/runtime/helpers/objectSpread2'));
var _objectWithoutProperties2 = _interopRequireDefault(
  require('@babel/runtime/helpers/objectWithoutProperties'),
);
var _react = _interopRequireDefault(require('react'));
var _antd = require('antd');
var _useOptions2 = _interopRequireDefault(require('../../hooks/useOptions'));
var _createField = _interopRequireDefault(require('../../createField'));
var _excluded = ['options', 'children'];
var Mentions = function Mentions(_ref) {
  var optionsProp = _ref.options,
    children = _ref.children,
    rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  var _useOptions = (0, _useOptions2.default)(optionsProp || []),
    options = _useOptions.options;
  return /*#__PURE__*/ _react.default.createElement(
    _antd.Mentions,
    (0, _objectSpread2.default)({}, rest),
    children
      ? children
      : options.map(function (option) {
          return /*#__PURE__*/ _react.default.createElement(
            _antd.Mentions.Option,
            {
              key: option.value,
              value: option.value,
            },
            option.label,
          );
        }),
  );
};
var FinalMentions = (0, _createField.default)(Mentions);
FinalMentions.Option = _antd.Mentions.Option;
var _default = FinalMentions;
exports.default = _default;
